package jy.game;


import java.util.ArrayList;
import java.util.List;

import wx.xml.simpleframework.xml.Attribute;
import wx.xml.simpleframework.xml.Element;

// [XmlType]
public class UserDefinedAnimtionData {

    @Attribute
    public String name;
    @Attribute
    public String type;
    @Element(name = "frame")
    public UserDefinedFrame[] frames;

    // (get) Token: 0x060002D5 RID: 725 RVA: 0x0001B6FC File Offset: 0x000198FC
    // [XmlIgnore]
    public Iterable<UserDefinedFrame> stands() {
        List<UserDefinedFrame> userDefinedFrames = new ArrayList<>();
        for (UserDefinedFrame f : this.frames) {
            if (f.tag.equals("stand")) {
                userDefinedFrames.add(f);
            }
        }
        return userDefinedFrames;
    }

    // (get) Token: 0x060002D6 RID: 726 RVA: 0x0001B720 File Offset: 0x00019920
    // [XmlIgnore]
    public Iterable<UserDefinedFrame> attacks() {
        List<UserDefinedFrame> userDefinedFrames = new ArrayList<>();

        for (UserDefinedFrame f : this.frames) {
            if (f.tag == "attack") {
                userDefinedFrames.add(f);
            }
        }
        return userDefinedFrames;
    }


//    public void FillAnimation(UserDefinedAnimation ani) {
//        if (this.type == "role") {
//            ani.stands = this.GetSprites(this.stands);
//            ani.attacks = this.GetSprites(this.attacks);
//            ani.moves = this.GetSprites(this.moves);
//            ani.beattacks = this.GetSprites(this.beattacks);
//            ani.bindImage.sprite = ani.stands[0];
//            ani.currentState = "stand";
//        } else if (this.type == "effect") {
//            ani.effects = this.GetSprites(this.effects);
//            ani.bindImage.sprite = ani.effects[0];
//        }
//    }
//

//        private Sprite[] GetSprites(Iterable<UserDefinedFrame> list) {
//            List<Sprite> list2 = new ArrayList<Sprite>();
//            for (UserDefinedFrame userDefinedFrame:list) {
//                list2.add(userDefinedFrame.sprite);
//            }
//            return list2.ToArray();
//        }

    // (get) Token: 0x060002D7 RID: 727 RVA: 0x0001B744 File Offset: 0x00019944
    // [XmlIgnore]
    public Iterable<UserDefinedFrame> moves() {
        List<UserDefinedFrame> userDefinedFrames = new ArrayList<>();

        for (UserDefinedFrame f : this.frames) {
            if (f.tag == "move") {
                userDefinedFrames.add(f);

            }
        }
        return userDefinedFrames;
    }

    // (get) Token: 0x060002D8 RID: 728 RVA: 0x0001B768 File Offset: 0x00019968
    // [XmlIgnore]
    public Iterable<UserDefinedFrame> beattacks() {
        List<UserDefinedFrame> userDefinedFrames = new ArrayList<>();

        for (UserDefinedFrame f : this.frames) {
            if (f.tag.equals("beattack")) {
                userDefinedFrames.add(f);
            }
        }
        return userDefinedFrames;
    }

    // (get) Token: 0x060002D9 RID: 729 RVA: 0x0001B78C File Offset: 0x0001998C
    // [XmlIgnore]
    public Iterable<UserDefinedFrame> effects() {
        List<UserDefinedFrame> userDefinedFrames = new ArrayList<>();
        for (UserDefinedFrame f : this.frames) {
            if (f.tag.equals("effect")) {
                userDefinedFrames.add(f);
            }
        }
        return userDefinedFrames;
    }
}